import java.util.*;


public class Main {
	public static void main1(String arg[]) {
		Scanner in=new Scanner(System.in);
		long ret=1;
		boolean flag=false;
		for(long i=2;i<=(long)Math.pow(2023, 2023);i++) {
			flag=false;
			for(long j=2;j<=Math.min(i, 2023);j++) {
				if(i%j==0&&2023%j==0) flag=true;
			}
			if(!flag) ret++;
		}
		System.out.println(ret);
	}
	public static void main(String arg[]) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		long[] nums=new long[2*n];
		for(int i=0;i<nums.length;i++) {
			nums[i]=in.nextLong();
		}
		Arrays.sort(nums);
		int left=0,right=nums.length-1;
		long ret=0;
		while(left<right) {
			ret+=nums[left++]*nums[right--];
		}
		System.out.println(ret);
		in.close();
	}
}